Add a standing Gmail search filter that scopes background sync - #94
Add a standing Gmail search filter that scopes background sync#94nocstah wants to merge 1 commit into
Conversation
A host can now pass an optional Gmail search query (e.g. 'label:brain') that the Gmail sync pipeline ANDs onto every page fetch, so background ingestion only stores matching messages while staying incremental: - ComposioMode (api host config): new gmail_sync_query field for the host to populate from its own config. - ComposioSyncConfig.gmail_query, plumbed through composio_config() and build_composio_pipeline(). - GmailSyncPipeline::with_filter(): a standing clause composed with the incremental after:<cursor> / sync_depth_days clause — unlike with_query(), which keeps its replace semantics for backfills. Lets a privacy-conscious user admit mail to memory by labeling it in Gmail instead of syncing the entire inbox window. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UMNxXS5ucxpzNoHnuhyQPu
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Warning Your free Security trial is over. An organization admin can activate billing to continue. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
How this change flows4 changed behaviours across 18 relationships. 6 surrounding behaviours are shown (60 graph nodes walked). 32 further behaviours left out to keep the diagram readable. flowchart LR
n0["build_composio_pipeline<br/>changed"]:::changed
n1["composio_config<br/>changed"]:::changed
n2["ComposioSyncConfig<br/>changed"]:::changed
n3["...nc_completes_against_the_namespace_driver<br/>changed"]:::changed
n4["Result"]:::impacted
n5["run_pipeline"]:::impacted
n6["a_held_connection_short_circuits_the_run"]:::impacted
n7["run_composio_connection_with_caps"]:::impacted
n8["from_workspace_dir"]:::impacted
n9["run_gmail_backfill"]:::impacted
n0 -->|uses| n4
n1 -->|uses| n4
n3 -->|uses| n2
n3 -->|calls| n8
n3 -->|tests| n8
n5 -->|uses| n4
n6 -->|calls| n5
n6 -->|tests| n5
n6 -->|calls| n8
n6 -->|tests| n8
n7 -->|calls| n0
n7 -->|calls| n1
n7 -->|uses| n4
n7 -->|calls| n5
n8 -->|uses| n4
n9 -->|calls| n1
n9 -->|uses| n4
n9 -->|calls| n5
classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge. |
Summary
Adds an optional standing Gmail search filter (e.g.
label:brain) that the Gmail sync pipeline ANDs onto every page fetch, so background ingestion only stores matching messages — while staying incremental. Lets a privacy-conscious host admit mail to memory by labeling it in Gmail (Gmail filters can auto-label whole categories) instead of syncing the entire inbox window.Related issue
None here — the host-side consumer is tinyhumansai/openhuman#5730-adjacent work; an OpenHuman PR wiring
[composio] gmail_sync_querythroughComposioMode.gmail_sync_queryfollows once this merges.API or behavior changes
Additive, non-breaking:
tinymemory-api: newComposioMode.gmail_sync_query: Option<String>field (Defaultcovers existing constructors).tinymemory-core: newComposioSyncConfig.gmail_query: Option<String>, populated bycomposio_config()in both modes;build_composio_pipeline()applies it to the Gmail pipeline.GmailSyncPipeline::with_filter()— a standing clause composed with the incrementalafter:<cursor>/sync_depth_daysclause. Deliberately distinct fromwith_query(), which keeps its existing replace semantics for backfills; a filter set alongside an override composes in front of it. With neither filter nor incremental clause, noqueryargument is emitted (unchanged).Validation
Commands actually run, with their outcome:
cargo fmt --all -- --check— cleancargo clippy -p tinymemory-api -p tinymemory-core --all-targets -- -D warnings— clean (scoped to the two changed crates)cargo build --all-targets --all-features— not run in full; the two changed crates build via the clippy/test runscargo test -p tinymemory-core --lib gmail— 17 passed (4 new)Tests
Four new tests in
sync::pipelines::composio::gmail::testspin the clause composition: filter+cursor composes (label:brain after:<ts>), filter alone scopes the first sync, no clauses ⇒ noqueryargument (regression guard), andwith_querystill replaces the cursor while composing with a filter. The e2e fixture (composio_gmail_non_tinycortex_e2e) gains the new field withNone(behavior unchanged).Documentation
Rustdoc on the new field, config field, and
with_filter()(including the with_query/with_filter semantic contrast). No separate docs pages affected.Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description🤖 Generated with Claude Code
https://claude.ai/code/session_01UMNxXS5ucxpzNoHnuhyQPu